<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head lang="en">
    <meta charset="UTF-8">
    <title>登录</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="stylesheet" th:href="@{/assets/css/amazeui.css}"/>
    <link th:href="@{/css/dlstyle.css}" rel="stylesheet" type="text/css">
    <script th:src="@{/assets/js/jquery.min.js}"></script>
</head>

<body>

<div class="login-boxtitle">
    <a href="index"><img alt="logo" th:src="@{/images/logobig.png}"/></a>
</div>

<div class="login-banner">
    <div class="login-main">
        <div class="login-banner-bg"><span></span><img th:src="@{/images/big.jpg}"/></div>
        <div class="login-box">

            <h3 class="title">登录商城</h3>

            <div class="clear"></div>

            <div class="login-form">
                <form>
                    <div class="user-name">
                        <label for="user"><i class="am-icon-user"></i></label>
                        <input type="text" name="" id="user" placeholder="邮箱/手机/用户名">
                    </div>
                    <div class="user-pass">
                        <label for="password"><i class="am-icon-lock"></i></label>
                        <input type="password" name="" id="password" placeholder="请输入密码">
                    </div>
                </form>
            </div>

            <div class="login-links">
                <label for="remember-me"><input id="remember-me" type="checkbox">记住密码</label>
                <a href="forgetPwd" class="am-fr">忘记密码</a>
                <a href="register" class="zcnext am-fr am-btn-default">注册</a>
                <br/>
            </div>
            <div class="am-cf">
                <input type="submit" name="login" value="登 录" class="am-btn am-btn-primary am-btn-sm">
                <a href="index">返回商城首页</a>
            </div>
        </div>
    </div>
</div>


<!-- introduce-->
<div th:include="public/pagehead::footer"></div>


<script th:src="@{/layuiadmin/layui/layui.all.js}">  </script>
    <script >

        ;!function(){
            //无需再执行layui.use()方法加载模块，直接使用即可
            var form = layui.form
                , layer = layui.layer;
            var $ = layui.$
                , admin = layui.admin
                , element = layui.element
                , layer = layui.layer
                , laydate = layui.laydate
                , form = layui.form;
            form.render();
            laydate.render();

            $('     input[name="login"]').on('click',function () {
                var user = $('#user').val();
                var password = $('#password').val();

                $.ajax({
                    url:'doLogin',
                    type:'post',
                    data:{
                        username:user,
                        password:password
                    },
                    async:false,
                    success:function (res) {
                        if(res.code==1){ // if(res.code== 1){
                            document.location.href="index"
                        }else{
                            layer.msg(res.msg,{
                                icon:6
                            })
                        }
                    },
                })
            })

        }();

    </script>

</body>

</html>